<template>
	<u-popup v-model="showPop" mode="center" border-radius="14" :closeable="true" width="600rpx">
		<view class="u-p-20 u-m-t-40 u-m-b-40">
			<view class="u-font-34 yu-bold yu-color-3 u-text-center">调整人员</view>
			<view class="u-font-34 yu-bold yu-color-3 u-text-center">{{classInfo.starttime+'-'+classInfo.endtime+' 【'+classInfo.classname+'】'}}</view>
			<scroll-view scroll-y="true" style="max-height: 550rpx;padding: 20rpx;">
				<u-checkbox-group @change="checkboxGroupChange">
					<u-checkbox v-model="stu.checked" v-for="(stu, index) in list" :key="index" :name="stu.paymentid">
						<view class="u-flex yu-between u-p-b-20">
							<u-avatar size="60" :src="$api.json('baseUrl')+'/upload/'+stu.headimg"></u-avatar>
							<view class="u-p-l-20 u-font-34 yu-color-3">
								{{stu.stuname +' '+stu.stuphone}}
							</view>
						</view>
					</u-checkbox>
				</u-checkbox-group>
			</scroll-view>
			<u-button type="warning" :ripple="true" ripple-bg-color="#909399" @click="adjustSave">确认调整</u-button>
		</view>
	</u-popup>
</template>

<script>
	export default {
		data() {
			return {
				showPop: false,
				classInfo: {},
				list: [],
				checkedItems:[]
			};
		},
		methods: {
			init(data) {
				this.checkedItems = []
				this.showPop = true
				this.classInfo = data
				this.$http('/class/findClassStu',{classid:data.classid}, (res) => {
						this.list = res.data
				})
			},
			checkboxGroupChange(val) {
				this.checkedItems = val
// 
			},
			adjustSave(){
				const checkList = this.list.map(e=>{
					if(e.checked){
						return e.paymentid
					}
				})
				const params = {
					paymentids: checkList[0]?checkList:[],
					classid:this.classInfo.classid
				}
				this.$http('/class/updateClassStu',params, (res) => {
					this.showPop = false
					this.$emit('adjustOver', res)
				})
			}
		}
	}
</script>

<style>

</style>
